<template>
    <div>
       		<div id="slider" class="mui-slider">
				<div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
					<div class="mui-scroll">
						<a :class="['mui-control-item',item.id==0?'mui-active':'']" v-for="item in tablabels" :key="item.id">
							{{item.title}}
						</a>
					</div>
				</div>
			</div>

            <ul class="imagelist">
                <router-link tag="li" :to="'/home/photoinfo/'+item.id" v-for="item in list" :key="item.id">
                    <img v-lazy="item.img_url">
                    <div class="info">
                        <h1 class="info-title">{{item.title}}</h1>
                        <div class="info-body">
                            {{item.zhaiyao}}
                        </div>
                    </div>
                </router-link>
            </ul>
    </div>
</template>

<script>
import mui from "../../lib/mui/js/mui.min.js";

export default {
  data() {
    return {
      tablabels: [],
      list: []
    };
  },
  created() {
    this.getAllCategory();
    this.getImages();
  },
  mounted() {
    mui(".mui-scroll-wrapper").scroll({
      deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
    });
  },
  methods: {
    getAllCategory() {
      this.tablabels = [
        { id: 1, title: "摄影器材" },
        { id: 2, title: "明星写真" },
        { id: 3, title: "清纯甜美" },
        { id: 4, title: "古典美女" },
        { id: 5, title: "家庭生活" },
        { id: 6, title: "私密照片" }
      ];
      this.tablabels.unshift({ id: 0, title: "全部" });
      this.$http
        .get("https://www.baidu.com/?tn=62095104_7_oem_dg")
        .then(result => {
          console.log(result);
        });
    },
    getImages() {
      this.list = [
        {
          id: 1,
          title: "美食沙拉",
          img_url:
            "http://fuss10.elemecdn.com/b/18/0678e57cb1b226c04888e7f244c20jpeg.jpeg",
          zhaiyao: "有气质的美女"
        },
        {
          id: 2,
          title: "减肥餐",
          img_url:
            "http://fuss10.elemecdn.com/3/1e/42634e29812e6594c98a89e922c60jpeg.jpeg",
          zhaiyao: "有气质的美女"
        },
        {
          id: 3,
          title: "寿司",
          img_url:
            "http://fuss10.elemecdn.com/1/c5/95c37272d3e554317dcec1e17a9f5jpeg.jpeg",
          zhaiyao: "有气质的美女"
        },
        {
          id: 4,
          title: "刺身",
          img_url:
            "http://fuss10.elemecdn.com/7/85/e478e4b26af74f4539c79f31fde80jpeg.jpeg",
          zhaiyao: "有气质的美女"
        },
        {
          id: 5,
          title: "盆摘",
          img_url:
            "http://fuss10.elemecdn.com/b/df/b630636b444346e38cef6c59f6457jpeg.jpeg",
          zhaiyao: "有气质的美女"
        },
        {
          id: 6,
          title: "薄荷叶",
          img_url:
            "http://fuss10.elemecdn.com/7/a5/596ab03934612236f807b92906fd8jpeg.jpeg",
          zhaiyao: "有气质的美女"
        }
      ];
      this.$http
        .get("https://www.baidu.com/?tn=62095104_7_oem_dg")
        .then(result => {
          console.log(result);
        });
    }
  }
};
</script>
<style lang="scss" scoped>
* {
  touch-action: pan-y;
}

.imagelist {
  list-style-type: none;
  padding: 0;
  margin: 0;
  li {
    position: relative;
  }
  img {
    width: 100%;
    padding: 0 5px;
    margin: 0;
  }
  img[lazy="loading"] {
    width: 40px;
    height: 300px;
    margin: auto;
  }
  .info {
    margin-left: 5px;
    margin-right: 5px;
    margin-bottom: 5px;
    position: absolute;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    color: white;
    text-align: left;
    width: 100%;
    .info-title {
      font-size: 14px;
      margin-left: 5px;
    }
    .info-body {
      font-size: 13px;
      margin-left: 5px;
      margin-bottom: 5px;
    }
  }
}
</style>
 
